﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.Practices.Unity;

namespace Skynet.BusinessLogic.Test.DataAccess
{
    [TestClass]
    public class QuestionTest
    {
        private static IUnityContainer Container;

        [ClassInitialize()]
        public static void Initialize(TestContext testContext)
        {

            Container = UnityHelper.BuildUnityContainer();
        }
        [TestMethod]
        public void QuestionCRUD()
        {

            //var repKind = Container.Resolve<BusinessLogic.DataAccess.IKindRepository>(); 
            //var kind =  repKind.GetByTitle("SimpleQuestion");
            //if ( kind == null) 
            //{
            //    kind = new BusinessEntities.Kind(){ Id =  Guid.NewGuid(), Title ="SimpleQuestion", Description="SimpleQuestion"};
            //    repKind.Add(kind);  
            //}
            //var kindAlt = repKind.GetByTitle("SimpleAlternative");
            //if (kindAlt == null)
            //{
            //    kindAlt = new BusinessEntities.Kind() { Id = Guid.NewGuid(), Title = "SimpleAlternative", Description = "SimpleAlternative" };
            //    repKind.Add(kindAlt);
            //}

            //var repCat = Container.Resolve<BusinessLogic.DataAccess.IExamCategoryRepository>();
            //var repExam = Container.Resolve<BusinessLogic.DataAccess.IExamRepository>();
            //var examcat = new BusinessEntities.ExamCategory();
            //examcat.Id = Guid.NewGuid();
            //examcat.Title = "testTitle";
            //examcat.Description = "Description Test";

            //repCat.Add(examcat);

            //var exam = new BusinessEntities.Exam();
            //exam.Id = Guid.NewGuid();
            //exam.CategoryExamId = examcat.Id;
            //exam.Title = "test";
            //exam.Summary = "test";
            //repExam.Add(exam);

            //var rep = Container.Resolve<BusinessLogic.DataAccess.IQuestionRepository>(); 

            //var q =  new BusinessEntities.TextQuestion ();  
            //q.Id = Guid.NewGuid(); 
            //q.Title = "test";  
            //q.Category ="test";  
            //q.Question ="test question";
            //q.ExamId = exam.Id; 

            //var alt = new BusinessEntities.TextAlternative(); 
            //alt.Id =  Guid.NewGuid();  
            //alt.Alternative ="opcion a"; 
            //alt.Answer ="truee"; 
            //alt.QuestionId =  q.Id; 
            //alt.Score = 1; 
   

            //q.Alternatives.AddLast(alt);
            
            //rep.Add(q);  
 

        }
    }
}
